class Solution2 {
    //左指针指向前驱 右指针指向后继
    public void preOrder(TreeNode root) {
        if(root==null) return;
        TreeNode preNode=null;
        preOrder(root.left);
        root.left=preNode;
        preNode=root;
        preOrder(root.right);
    }
    public TreeNode treeToDoublyList(TreeNode root) {
        TreeNode pCur = root;
        preOrder(root);
        return root;
    }
}